package com.runshu.newsmartark.mvp.presenter;

import com.runshu.newsmartark.mvp.contract.FaceCodeContract;
import com.runshu.newsmartark.network.netbean.ResponseBean;
import com.runshu.newsmartark.network.netinterface.BaseCallBack;
import com.runshu.newsmartark.network.netinterface.MyCallBack;

/**
 * Demo class
 *
 * @author yu
 * @date 2021/11/22
 * @decs：
 */

public class FaceCodePresenter implements FaceCodeContract.Presenter {

    private FaceCodeContract.View view;
    private FaceCodeContract.Model model;

    public FaceCodePresenter(FaceCodeContract.View view, FaceCodeContract.Model model) {
        this.view = view;
        this.model = model;
    }

    @Override
    public void verifyFaceCode(String faceCode, BaseCallBack baseCallBack) {
            model.verifyFaceCode(faceCode, new MyCallBack() {
                @Override
                public void onSuccess(ResponseBean data) {
                    view.verifyFaceCodeSuccess(data);
                }

                @Override
                public void onError(ResponseBean data) {
                    view.onError(data.getMessage());
                }
            });
    }
}